


function addnews(){
	top.jzts();
	var diag = new top.Dialog();
	diag.Drag=true;
	diag.Title ="新闻记录";
	diag.URL = '/main/news_record_create';
	diag.Width = 950;
	diag.Height = 800;
	diag.CancelEvent = function(){ //关闭事件
		$("#Form").submit();
		diag.close();
	};
	diag.show();
}


function editnews(){
	var str = '';
	var flag = false;
	for(var i=0;i < document.getElementsByName('ids').length;i++)
	{
		  if(document.getElementsByName('ids')[i].checked){
		  	if(str=='') str += document.getElementsByName('ids')[i].value;
		  	else{
		  		flag = true;
		  		break;
		  		str += ',' + document.getElementsByName('ids')[i].value;
		  	}
		  }
	}
	if (flag){
		bootbox.dialog("您选择了多条记录", 
				[
				  {
					"label" : "关闭",
					"class" : "btn-small btn-success",
					"callback": function() {
						//Example.show("great success");
						}
					}
				 ]
			);
		return false;
	}
	
	if(str==''){
		bootbox.dialog("您没有选择任何内容!", 
			[
			  {
				"label" : "关闭",
				"class" : "btn-small btn-success",
				"callback": function() {
					//Example.show("great success");
					}
				}
			 ]
		);
		return;
	}else{
		top.jzts();
		var diag = new top.Dialog();
		diag.Drag=true;
		diag.Title ="编辑新闻信息";
		diag.URL = '/main/'+str+'/news_record_update';
		diag.Width = 950;
		diag.Height = 800;
		diag.CancelEvent = function(){ //关闭事件
			$("#Form").submit();
			diag.close();
		};
		diag.show();
	}
}


function view_news(){
	var str = '';
	var flag = false;
	for(var i=0;i < document.getElementsByName('ids').length;i++)
	{
		  if(document.getElementsByName('ids')[i].checked){
		  	if(str=='') str += document.getElementsByName('ids')[i].value;
		  	else{
		  		flag = true;
		  		break;
		  		str += ',' + document.getElementsByName('ids')[i].value;
		  	}
		  }
	}
	if (flag){
		bootbox.dialog("您选择了多条记录", 
				[
				  {
					"label" : "关闭",
					"class" : "btn-small btn-success",
					"callback": function() {
						//Example.show("great success");
						}
					}
				 ]
			);
		return false;
	}
	
	if(str==''){
		bootbox.dialog("您没有选择任何内容!", 
			[
			  {
				"label" : "关闭",
				"class" : "btn-small btn-success",
				"callback": function() {
					//Example.show("great success");
					}
				}
			 ]
		);
		return;
	}else{
		top.jzts();
		var diag = new top.Dialog();
		diag.Drag=true;
		diag.Title ="新闻信息查看";
		diag.URL = '/main/'+str+'/news_record_view';
		diag.Width = 950;
		diag.Height = 800;
		diag.CancelEvent = function(){ //关闭事件
			$("#Form").submit();
			diag.close();
		};
		diag.show();
	}
}


//新闻状态修改
function changestatu(status){
	var str = '';
	for(var i=0;i < document.getElementsByName('ids').length;i++)
	{
		  if(document.getElementsByName('ids')[i].checked){
		  	if(str=='') str += document.getElementsByName('ids')[i].value;
		  	else{
		  		str += ',' + document.getElementsByName('ids')[i].value;
		  	}
		  }
	}
	
	if(str==''){
		bootbox.dialog("您没有选择任何内容!", 
			[
			  {
				"label" : "关闭",
				"class" : "btn-small btn-success",
				"callback": function() {
					//Example.show("great success");
					}
				}
			 ]
		);
		return;
	}else{
		bootbox.confirm("确定对新闻进行修改吗?", function(result) {
			if(result) {
				$.ajax({
					type: "post",
					url: '/main/news_message_status_change',
			    	data: {news_ids:str,status:status,tm:new Date().getTime()},
					dataType:'json',
					cache: false,
					success: function(data){
						 if("success" == data.result){
							 alert("新闻信息修改成功！");
							 $("#Form").submit();
						 }else{
							 alert("新闻信息修改失败，请重试！");
							 return false;
						 }
					}
				});
			}
		});
	}
}

function addcoopertion(){
	top.jzts();
	var diag = new top.Dialog();
	diag.Drag=true;
	diag.Title ="合作信息添加";
	diag.URL = '/main/coopertion_record_create';
	diag.Width = 800;
	diag.Height = 500;
	diag.CancelEvent = function(){ //关闭事件
		$("#Form").submit();
		diag.close();
	};
	diag.show();
}

function editcoopertion(){
	var str = '';
	var flag = false;
	for(var i=0;i < document.getElementsByName('ids').length;i++)
	{
		  if(document.getElementsByName('ids')[i].checked){
		  	if(str=='') str += document.getElementsByName('ids')[i].value;
		  	else{
		  		flag = true;
		  		break;
		  		str += ',' + document.getElementsByName('ids')[i].value;
		  	}
		  }
	}
	if (flag){
		bootbox.dialog("您选择了多条记录", 
				[
				  {
					"label" : "关闭",
					"class" : "btn-small btn-success",
					"callback": function() {
						//Example.show("great success");
						}
					}
				 ]
			);
		return false;
	}
	
	if(str==''){
		bootbox.dialog("您没有选择任何内容!", 
			[
			  {
				"label" : "关闭",
				"class" : "btn-small btn-success",
				"callback": function() {
					//Example.show("great success");
					}
				}
			 ]
		);
		return;
	}else{
		top.jzts();
		var diag = new top.Dialog();
		diag.Drag=true;
		diag.Title ="编辑合作单位";
		diag.URL = '/main/'+str+'/coopertion_record_update';
		diag.Width = 800;
		diag.Height = 500;
		diag.CancelEvent = function(){ //关闭事件
			$("#Form").submit();
			diag.close();
		};
		diag.show();
	}
}

function view_coopertion(){
	var str = '';
	var flag = false;
	for(var i=0;i < document.getElementsByName('ids').length;i++)
	{
		  if(document.getElementsByName('ids')[i].checked){
		  	if(str=='') str += document.getElementsByName('ids')[i].value;
		  	else{
		  		flag = true;
		  		break;
		  		str += ',' + document.getElementsByName('ids')[i].value;
		  	}
		  }
	}
	if (flag){
		bootbox.dialog("您选择了多条记录", 
				[
				  {
					"label" : "关闭",
					"class" : "btn-small btn-success",
					"callback": function() {
						//Example.show("great success");
						}
					}
				 ]
			);
		return false;
	}
	
	if(str==''){
		bootbox.dialog("您没有选择任何内容!", 
			[
			  {
				"label" : "关闭",
				"class" : "btn-small btn-success",
				"callback": function() {
					//Example.show("great success");
					}
				}
			 ]
		);
		return;
	}else{
		top.jzts();
		var diag = new top.Dialog();
		diag.Drag=true;
		diag.Title ="合作单位信息查看";
		diag.URL = '/main/'+str+'/coopertion_record_view';
		diag.Width = 800;
		diag.Height = 500;
		diag.CancelEvent = function(){ //关闭事件
			$("#Form").submit();
			diag.close();
		};
		diag.show();
	}
}


//合作单位状态修改
function changecoopertionstatu(status){
	var str = '';
	for(var i=0;i < document.getElementsByName('ids').length;i++)
	{
		  if(document.getElementsByName('ids')[i].checked){
		  	if(str=='') str += document.getElementsByName('ids')[i].value;
		  	else{
		  		str += ',' + document.getElementsByName('ids')[i].value;
		  	}
		  }
	}
	
	if(str==''){
		bootbox.dialog("您没有选择任何内容!", 
			[
			  {
				"label" : "关闭",
				"class" : "btn-small btn-success",
				"callback": function() {
					//Example.show("great success");
					}
				}
			 ]
		);
		return;
	}else{
		bootbox.confirm("确定对合作单位状态修改吗?", function(result) {
			if(result) {
				$.ajax({
					type: "post",
					url: '/main/coopertion_message_status_change',
			    	data: {coopertion_ids:str,status:status,tm:new Date().getTime()},
					dataType:'json',
					cache: false,
					success: function(data){
						 if("success" == data.result){
							 alert("合作单位状态修改成功！");
							 $("#Form").submit();
						 }else{
							 alert("合作单位状态修改失败，请重试！");
							 return false;
						 }
					}
				});
			}
		});
	}
}

function web_img_edit(webimg_id){
	top.jzts();
	var diag = new top.Dialog();
	diag.Drag=true;
	diag.Title ="网页图片编辑";
	diag.URL = '/main/'+webimg_id+'/webimg_record_update';
	diag.Width = 640;
	diag.Height = 400;
	diag.CancelEvent = function(){ //关闭事件
		$("#Form").submit();
		diag.close();
	};
	diag.show();
}

